package com.bdqn.business.academic.controller;

import com.bdqn.aop.Log;
import com.bdqn.business.academic.service.SchoolService;
import com.bdqn.entity.academic.School;
import com.bdqn.error.CommonException;
import com.bdqn.response.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/school")
public class SchoolController {

    @Autowired
    private SchoolService schoolService;

    @Log("获取学校列表")
    @RequestMapping(value = "/getList",method = RequestMethod.POST)
    public Result getList(@RequestBody Map<String,Object> map){
        return schoolService.getList(map);
    }

    @Log("保存学校")
    @RequestMapping(value = "/save",method = RequestMethod.POST)
    public Result save(@RequestBody School school){
        return schoolService.save(school);
    }

    @Log("学校级联阶段")
    @RequestMapping(value = "/getCurriculumChildrenBySchool",method = RequestMethod.GET)
    public Result getCurriculumChildrenBySchool(){
        return schoolService.getCurriculumChildrenBySchool();
    }

    @Log("学校级联课程")
    @RequestMapping(value = "/getBooksChildrenBySchool",method = RequestMethod.GET)
    public Result getBooksChildrenBySchool() throws CommonException {
        return schoolService.getBooksChildrenBySchool();
    }

    @Log("学校级联章节")
    @RequestMapping(value = "/getChapterChildrenBySchool",method = RequestMethod.GET)
    public Result getChapterChildrenBySchool() throws CommonException {
        return schoolService.getChapterChildrenBySchool();
    }

    @Log("学校级联班级")
    @RequestMapping(value = "/getClassesChildrenBySchool",method = RequestMethod.GET)
    public Result getClassesChildrenBySchool() throws CommonException {
        return schoolService.getClassesChildrenBySchool();
    }
}
